home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / Events.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  10.2 KB  |  389 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Events.a
  3. ;
  4. ;    Contains:    Event Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    Mac OS 8
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  18. __EVENTS__ SET 1
  19.  
  20.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  21.     include 'OSUtils.a'
  22.     ENDIF
  23.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  24.     include 'Quickdraw.a'
  25.     ENDIF
  26.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  27.     include 'MacTypes.a'
  28.     ENDIF
  29.  
  30.     IF ¬ TARGET_OS_MAC THEN
  31.     IF &TYPE('__ENDIAN__') = 'UNDEFINED' THEN
  32.     include 'Endian.a'
  33.     ENDIF
  34.     ENDIF
  35. ; typedef UInt16                         EventKind
  36.  
  37. ; typedef UInt16                         EventMask
  38.  
  39.  
  40. nullEvent                        EQU        0
  41. mouseDown                        EQU        1
  42. mouseUp                            EQU        2
  43. keyDown                            EQU        3
  44. keyUp                            EQU        4
  45. autoKey                            EQU        5
  46. updateEvt                        EQU        6
  47. diskEvt                            EQU        7
  48. activateEvt                        EQU        8
  49. osEvt                            EQU        15
  50. kHighLevelEvent                    EQU        23
  51.  
  52. mDownMask                        EQU        $02                    ; mouse button pressed
  53. mUpMask                            EQU        $04                    ; mouse button released
  54. keyDownMask                        EQU        $08                    ; key pressed
  55. keyUpMask                        EQU        $10                    ; key released
  56. autoKeyMask                        EQU        $20                    ; key repeatedly held down
  57. updateMask                        EQU        $40                    ; window needs updating
  58. diskMask                        EQU        $80                    ; disk inserted
  59. activMask                        EQU        $0100                ; activate/deactivate window
  60. highLevelEventMask                EQU        $0400                ; high-level events (includes AppleEvents)
  61. osMask                            EQU        $8000                ; operating system events (suspend, resume)
  62. everyEvent                        EQU        $FFFF                ; all of the above
  63.  
  64. charCodeMask                    EQU        $000000FF
  65. keyCodeMask                        EQU        $0000FF00
  66. adbAddrMask                        EQU        $00FF0000
  67. osEvtMessageMask                EQU        $FF000000
  68.  
  69.                                                             ; OS event messages.  Event (sub)code is in the high byte of the message field.
  70. mouseMovedMessage                EQU        $00FA
  71. suspendResumeMessage            EQU        $0001
  72.  
  73. resumeFlag                        EQU        1                    ; Bit 0 of message indicates resume vs suspend
  74. convertClipboardFlag            EQU        2                    ; Bit 1 in resume message indicates clipboard change
  75.  
  76. ; typedef UInt16                         EventModifiers
  77.  
  78.  
  79.                                                             ; modifiers 
  80. activeFlagBit                    EQU        0                    ; activate? (activateEvt and mouseDown)
  81. btnStateBit                        EQU        7                    ; state of button?
  82. cmdKeyBit                        EQU        8                    ; command key down?
  83. shiftKeyBit                        EQU        9                    ; shift key down?
  84. alphaLockBit                    EQU        10                    ; alpha lock down?
  85. optionKeyBit                    EQU        11                    ; option key down?
  86. controlKeyBit                    EQU        12                    ; control key down?
  87. rightShiftKeyBit                EQU        13                    ; right shift key down?
  88. rightOptionKeyBit                EQU        14                    ; right Option key down?
  89. rightControlKeyBit                EQU        15                    ; right Control key down?
  90.  
  91. activeFlag                        EQU        $01
  92. btnState                        EQU        $80
  93. cmdKey                            EQU        $0100
  94. shiftKey                        EQU        $0200
  95. alphaLock                        EQU        $0400
  96. optionKey                        EQU        $0800
  97. controlKey                        EQU        $1000
  98. rightShiftKey                    EQU        $2000
  99. rightOptionKey                    EQU        $4000
  100. rightControlKey                    EQU        $8000
  101.  
  102. kNullCharCode                    EQU        0
  103. kHomeCharCode                    EQU        1
  104. kEnterCharCode                    EQU        3
  105. kEndCharCode                    EQU        4
  106. kHelpCharCode                    EQU        5
  107. kBellCharCode                    EQU        7
  108. kBackspaceCharCode                EQU        8
  109. kTabCharCode                    EQU        9
  110. kLineFeedCharCode                EQU        10
  111. kVerticalTabCharCode            EQU        11
  112. kPageUpCharCode                    EQU        11
  113. kFormFeedCharCode                EQU        12
  114. kPageDownCharCode                EQU        12
  115. kReturnCharCode                    EQU        13
  116. kFunctionKeyCharCode            EQU        16
  117. kEscapeCharCode                    EQU        27
  118. kClearCharCode                    EQU        27
  119. kLeftArrowCharCode                EQU        28
  120. kRightArrowCharCode                EQU        29
  121. kUpArrowCharCode                EQU        30
  122. kDownArrowCharCode                EQU        31
  123. kDeleteCharCode                    EQU        127
  124. kNonBreakingSpaceCharCode        EQU        202
  125. EventRecord                RECORD 0
  126. what                     ds.w    1                ; offset: $0 (0)
  127. message                     ds.l    1                ; offset: $2 (2)
  128. when                     ds.l    1                ; offset: $6 (6)
  129. where                     ds        Point            ; offset: $A (10)
  130. modifiers                 ds.w    1                ; offset: $E (14)
  131. sizeof                     EQU *                    ; size:   $10 (16)
  132.                         ENDR
  133.  
  134. ;
  135. ; pascal void GetMouse(Point *mouseLoc)
  136. ;
  137.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  138.         _GetMouse:    OPWORD    $A972
  139.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  140.         IMPORT_CFM_FUNCTION GetMouse
  141.     ENDIF
  142.  
  143. ;
  144. ; pascal Boolean Button(void )
  145. ;
  146.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  147.         _Button:    OPWORD    $A974
  148.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  149.         IMPORT_CFM_FUNCTION Button
  150.     ENDIF
  151.  
  152. ;
  153. ; pascal Boolean StillDown(void )
  154. ;
  155.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  156.         _StillDown:    OPWORD    $A973
  157.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  158.         IMPORT_CFM_FUNCTION StillDown
  159.     ENDIF
  160.  
  161. ;
  162. ; pascal Boolean WaitMouseUp(void )
  163. ;
  164.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  165.         _WaitMouseUp:    OPWORD    $A977
  166.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  167.         IMPORT_CFM_FUNCTION WaitMouseUp
  168.     ENDIF
  169.  
  170. ;
  171. ; pascal UInt32 TickCount(void )
  172. ;
  173.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  174.         _TickCount:    OPWORD    $A975
  175.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  176.         IMPORT_CFM_FUNCTION TickCount
  177.     ENDIF
  178.  
  179. ;
  180. ; pascal UInt32 KeyTranslate(const void *transData, UInt16 keycode, UInt32 *state)
  181. ;
  182.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  183.         _KeyTranslate:    OPWORD    $A9C3
  184.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  185.         IMPORT_CFM_FUNCTION KeyTranslate
  186.     ENDIF
  187.  
  188. ;
  189. ; pascal UInt32 GetCaretTime(void)
  190. ;
  191.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  192.         Macro
  193.         _GetCaretTime         &dest=(sp)
  194.             move.l            $02F4,&dest
  195.         EndM
  196.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  197.         IMPORT_CFM_FUNCTION GetCaretTime
  198.     ENDIF
  199.  
  200.  
  201. KeyMap                    RECORD 0
  202. map                         ds.b    16                ; offset: $0 (0)
  203. sizeof                     EQU *                    ; size:   $10 (16)
  204.                         ENDR
  205. ;
  206. ; pascal void GetKeys(KeyMap theKeys)
  207. ;
  208.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  209.         _GetKeys:    OPWORD    $A976
  210.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  211.         IMPORT_CFM_FUNCTION GetKeys
  212.     ENDIF
  213.  
  214.  
  215.  
  216. ;  Obsolete event types & masks 
  217.  
  218. networkEvt                        EQU        10
  219. driverEvt                        EQU        11
  220. app1Evt                            EQU        12
  221. app2Evt                            EQU        13
  222. app3Evt                            EQU        14
  223. app4Evt                            EQU        15
  224. networkMask                        EQU        $0400
  225. driverMask                        EQU        $0800
  226. app1Mask                        EQU        $1000
  227. app2Mask                        EQU        $2000
  228. app3Mask                        EQU        $4000
  229. app4Mask                        EQU        $8000
  230. EvQEl                    RECORD 0
  231. qLink                     ds.l    1                ; offset: $0 (0)
  232. qType                     ds.w    1                ; offset: $4 (4)
  233. evtQWhat                 ds.w    1                ; offset: $6 (6)        ;  this part is identical to the EventRecord as defined above 
  234. evtQMessage                 ds.l    1                ; offset: $8 (8)
  235. evtQWhen                 ds.l    1                ; offset: $C (12)
  236. evtQWhere                 ds        Point            ; offset: $10 (16)
  237. evtQModifiers             ds.w    1                ; offset: $14 (20)
  238. sizeof                     EQU *                    ; size:   $16 (22)
  239.                         ENDR
  240. ; typedef struct EvQEl *                EvQElPtr
  241.  
  242. ; typedef GetNextEventFilterUPP         GNEFilterUPP
  243.  
  244. ;
  245. ; pascal QHdrPtr GetEvQHdr(void )
  246. ;
  247.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  248.         Macro
  249.         _GetEvQHdr            &dest=(sp)
  250.             move.l            #$0000014A,&dest
  251.         EndM
  252.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  253.         IMPORT_CFM_FUNCTION GetEvQHdr
  254.     ENDIF
  255.  
  256. ;
  257. ; pascal UInt32 GetDblTime(void)
  258. ;
  259.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  260.         Macro
  261.         _GetDblTime           &dest=(sp)
  262.             move.l            $02F0,&dest
  263.         EndM
  264.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  265.         IMPORT_CFM_FUNCTION GetDblTime
  266.     ENDIF
  267.  
  268. ;
  269. ; pascal void SetEventMask(EventMask value)
  270. ;
  271.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  272.         Macro
  273.         _SetEventMask         &src=(sp)+
  274.             move.w            &src,$0144
  275.         EndM
  276.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  277.         IMPORT_CFM_FUNCTION SetEventMask
  278.     ENDIF
  279.  
  280. ;
  281. ; pascal OSErr PPostEvent(EventKind eventCode, UInt32 eventMsg, EvQElPtr *qEl)
  282. ;
  283.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  284.         _PPostEvent:    OPWORD    $A12F
  285.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  286.         IMPORT_CFM_FUNCTION PPostEvent
  287.     ENDIF
  288.  
  289. ;
  290. ; pascal Boolean GetNextEvent(EventMask eventMask, EventRecord *theEvent)
  291. ;
  292.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  293.         _GetNextEvent:    OPWORD    $A970
  294.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  295.         IMPORT_CFM_FUNCTION GetNextEvent
  296.     ENDIF
  297.  
  298. ;
  299. ; pascal Boolean WaitNextEvent(EventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn)
  300. ;
  301.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  302.         _WaitNextEvent:    OPWORD    $A860
  303.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  304.         IMPORT_CFM_FUNCTION WaitNextEvent
  305.     ENDIF
  306.  
  307. ;
  308. ; pascal Boolean EventAvail(EventMask eventMask, EventRecord *theEvent)
  309. ;
  310.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  311.         _EventAvail:    OPWORD    $A971
  312.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  313.         IMPORT_CFM_FUNCTION EventAvail
  314.     ENDIF
  315.  
  316.  
  317. ;
  318. ; pascal OSErr PostEvent(EventKind eventNum, UInt32 eventMsg)
  319. ;
  320.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  321.         ; parameters:
  322.         ;    eventNum        => A0
  323.         ;    eventMsg        => D0
  324.         ; returns:
  325.         ;    OSErr           <= D0
  326.         _PostEvent:    OPWORD    $A02F
  327.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  328.         IMPORT_CFM_FUNCTION PostEvent
  329.     ENDIF
  330.  
  331. ;
  332. ; pascal Boolean OSEventAvail(EventMask mask, EventRecord *theEvent)
  333. ;
  334.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  335.         _OSEventAvail:    OPWORD    $A030
  336.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  337.         IMPORT_CFM_FUNCTION OSEventAvail
  338.     ENDIF
  339.  
  340. ;
  341. ; pascal Boolean GetOSEvent(EventMask mask, EventRecord *theEvent)
  342. ;
  343.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  344.         _GetOSEvent:    OPWORD    $A031
  345.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  346.         IMPORT_CFM_FUNCTION GetOSEvent
  347.     ENDIF
  348.  
  349. ;
  350. ; pascal void FlushEvents(EventMask whichMask, EventMask stopMask)
  351. ;
  352.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  353.         _FlushEvents:    OPWORD    $A032
  354.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  355.         IMPORT_CFM_FUNCTION FlushEvents
  356.     ENDIF
  357.  
  358. ;
  359. ; pascal void SystemClick(const EventRecord *theEvent, WindowPtr theWindow)
  360. ;
  361.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  362.         _SystemClick:    OPWORD    $A9B3
  363.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  364.         IMPORT_CFM_FUNCTION SystemClick
  365.     ENDIF
  366.  
  367. ;
  368. ; pascal void SystemTask(void )
  369. ;
  370.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  371.         _SystemTask:    OPWORD    $A9B4
  372.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  373.         IMPORT_CFM_FUNCTION SystemTask
  374.     ENDIF
  375.  
  376. ;
  377. ; pascal Boolean SystemEvent(const EventRecord *theEvent)
  378. ;
  379.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  380.         _SystemEvent:    OPWORD    $A9B2
  381.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  382.         IMPORT_CFM_FUNCTION SystemEvent
  383.     ENDIF
  384.  
  385.  
  386.  
  387.     ENDIF ; __EVENTS__ 
  388.  
  389.